import java.util.Arrays;
import java.util.Locale;

/**
 * @Author 12629
 * @Description：
 */
public class Test {
    public static void main(String[] args) {
        String str = "name=zhangsan&name=lisi";
        String[] strings = str.split("&");
        //strings2[0]:  name=zhangsan           strings2[1]: name=lisi
        for(String s : strings) {
            //System.out.println(s);
            String[] ss = s.split("=");
            for(String x : ss) {
                System.out.println(x);
            }
        }
    }
    public static void main4(String[] args) {
        String str = "abc\\def\\hij";//  abc\def\hij
        //limit 最多分为几组
        String[] strings = str.split("\\\\");// \
        for(String s : strings) {
            System.out.println(s);
        }

        System.out.println("===========");
        String str2 = "abc&def=hij";
        String[] strings2 = str2.split("&|=");
        for(String s : strings2) {
            System.out.println(s);
        }

    }
    public static void main3(String[] args) {
        String str = "ababc";
        //字符的整体替换
        String ret = str.replace('a','l');
        System.out.println(ret);

        //字符串的整体替换
        String ret2 = str.replace("ab","kkk");
        System.out.println(ret2);

        //替换字符串的第一个
        String ret3 = str.replaceFirst("ab","kkkk");
        System.out.println(ret3);

        //字符串的整体替换
        String ret4 = str.replaceAll("a","ppp");
        System.out.println(ret4);

    }
    public static void main2(String[] args) {
        String s1 = String.valueOf(1234);
        String s2 = String.valueOf(12.34);
        String s3 = String.valueOf(true);

        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);

        int data1 = Integer.parseInt("1234");
        double data2 = Double.parseDouble("12.34");
        System.out.println(data1+1);
        System.out.println(data2+1);

        String str2 = "ABCD";
        String str3 = str2.toLowerCase();
        System.out.println(str3);
        System.out.println(str2);

        String str1 = "abcd";
        System.out.println(str1.toUpperCase());



        char[] array = str1.toCharArray();//把字符串 转为数组
        System.out.println(Arrays.toString(array));


        String s = String.format("%d-%d-%d", 2019, 9,14);
        System.out.println(s);


    }

    public static void main1(String[] args) {
        String str1 = "abcd";
        String str2 = "ABCD";

        //比较字符串的大小
        System.out.println(str1.compareToIgnoreCase(str2));

        char ch = str1.charAt(1);
        System.out.println(ch);

        int index = str1.indexOf('a',2);
        System.out.println(index);

        int index2 = str1.indexOf("bc");
        System.out.println(index2);

        String str3 = "ababcabcd";
        //指定位置 从后往前找 'a'
        int index3 = str3.lastIndexOf('a',4);
        System.out.println(index3);

    }
}